Skip to content

Conversation

@fivecar
Copy link

@fivecar fivecar commented Dec 7, 2022

Reason for Change

This tries to address the following code flow:

  setState("hi", 3000)
  ...
  setState("bye")

I believe most developers' expectation would be that the second setState cancels the ongoing timer (i.e. you shouldn't get "hi" after you then asked for an immediate setState to "bye"). This attempts to fix that.

I've also fixed all lint errors and updated the safe browser list to the latest.

Test Plan

Updated the example code, npm start, and verify that the example continues to run correctly.

@fivecar
Copy link
Author

fivecar commented Dec 7, 2022

Hmm. I now notice this goes against the original documented behavior of the component.

I've updated the README to reflect its new behavior, but am open to disagreement on what the real desired behavior for most engineers will be. My personal expectation is that it should behave as this PR suggests...

I've created use-delay-follow-state to reflect this behavior, as well as adding a useFollowState function in case it's helpful to anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant